Template based container classes. More...
![]() |
Data Structures | |
class | TArrayBase< T > |
Template array base class. More... | |
class | TArray< T > |
Array container template. More... | |
class | TOrderedArray< T > |
Ordered Array container template. More... | |
class | TSortableArray< T > |
Sortable Array container template. More... | |
class | TBag< T > |
Bag template. More... | |
class | TBinaryTree< T > |
TBinaryTree is a rooted binary tree. More... | |
class | TBTree< T > |
BTree template definition. More... | |
class | TBTreeIterator< T > |
Iterator for the BTree template. More... | |
class | TBTreeDictionary< K, O > |
B-Tree dictionary template definition. More... | |
class | TBTreeSet< T > |
B-Tree set template definition. More... | |
class | TContainer< T > |
Template container base class (abstract). More... | |
class | TIterator< T > |
Template container iterator base class (abstract). More... | |
class | TDLinkedList< T > |
Doubly linked template list. More... | |
class | THashTable< T > |
Hash Table templateA hash table is a list of buckets. More... | |
class | TLinkedList< T > |
Single linked list template definition. More... | |
class | TQueue< T > |
Queue template. More... | |
class | TRingBuffer< T > |
RingBuffer template. More... | |
class | TVector< T > |
TVector provides a basic templated container for arrays of dynamic sizeTVector is a base class that is not meant to be derived from. More... | |
class | TAssociation< T, O > |
Association template definition. More... | |
class | TAssociationArray< K, O > |
Association Array template definition. More... | |
class | TDeque< T > |
TDeque is a double ended queue. More... | |
class | THashSet< T > |
A hash set is a collection of items, without any particular order and without repetitions stored in a hash table. More... | |
class | TStack< T > |
TStack is a template container based on the LIFO-principle (last in/first out). More... | |
Modules | |
FUnknown/FObject Containers | |
This group contains some classes and macros that allow collecting instances of FUnknown or FObject in template containers. | |
Defines | |
#define | ARRAY_FOR_EACH_TYPE(type, obj, containter) |
Special array iteration macro - can be used like FOREACH_T only that type is assumed to be a pointer. | |
#define | ARRAY_FOR_EACH_TYPE_REVERSE(type, obj, containter) |
Special array iteration macro - can be used instead of FOREACH_T_REVERSE only that type is assumed to be a pointer. | |
#define | ARRAY_FOR_EACH_TYPE_I(type, obj, containter, index) |
Special array iteration macro - Version with explicit loop variable index. | |
#define | ARRAY_FOR_EACH_TYPE_REVERSE_I(type, obj, containter, index) |
Special array iteration macro - Like ARRAY_FOR_EACH_TYPE_I only backwards. | |
#define | FOREACH_T(type, varName, cont) |
Defines a forward loop. | |
#define | FOREACH_T_REVERSE(type, varName, cont) |
Defines a reverse loop. | |
#define | ENDFOR } } |
Terminates the loop. |
Template based container classes.
This module contains a number of standard container template classes. They all derive from TContainer. Each container has a corresponding iterator class, that all derive from TIterator.
All container classes are intended to be used as they are. None of them should be used as base class to derive from!
Template Iteration Macros.
The Iteration Macros FOREACH_T , FOREACH_T_REVERSE and ENDFOR define a foreach loop where the item, type and collection are passed in and the item will be set equal to the next item in the collection for each loop iteration. These macros are supposed to work on any container derived from Steinberg::TContainer
Example:
TLinkedList<int> myList; myList.add (10); ... int sum = 0; FOREACH_T (int, i, myList) sum += i; ENDFOR
For containers of type TArrayBase some special iteration macros are supplied that support iteration without the need to allocate an iterator (ARRAY_FOR_EACH_TYPE , ARRAY_FOR_EACH_TYPE_I)
#define ARRAY_FOR_EACH_TYPE | ( | type, | |||
obj, | |||||
containter | ) |
{ for (int32 i = 0; i < containter.total (); i++) \ { type* obj = containter.at (i); \ if (!obj) continue;
Special array iteration macro - can be used like FOREACH_T only that type is assumed to be a pointer.
#define ARRAY_FOR_EACH_TYPE_REVERSE | ( | type, | |||
obj, | |||||
containter | ) |
{ for (int32 i = containter.total () - 1; i >= 0 ; i--) \ { type* obj = containter.at (i); \ if (!obj) continue;
Special array iteration macro - can be used instead of FOREACH_T_REVERSE only that type is assumed to be a pointer.
#define ARRAY_FOR_EACH_TYPE_I | ( | type, | |||
obj, | |||||
containter, | |||||
index | ) |
{ for (int32 index = 0; index < containter.total (); index++) \ { type* obj = containter.at (index); \ if (!obj) continue;
Special array iteration macro - Version with explicit loop variable index.
#define ARRAY_FOR_EACH_TYPE_REVERSE_I | ( | type, | |||
obj, | |||||
containter, | |||||
index | ) |
{ for (int32 index = containter.total () - 1; index >= 0 ; index--) \ { type* obj = containter.at (index); \ if (!obj) continue;
Special array iteration macro - Like ARRAY_FOR_EACH_TYPE_I only backwards.
#define FOREACH_T | ( | type, | |||
varName, | |||||
cont | ) |
{ \ Steinberg::TIterator<type>* iter = (cont).newIterator (); \ Steinberg::FDeleter <Steinberg::TIterator<type> > iterDeleter (iter);\ while (!iter->done ()) { \ type& varName = iter->next ();
Defines a forward loop.
#define FOREACH_T_REVERSE | ( | type, | |||
varName, | |||||
cont | ) |
{ \ Steinberg::TIterator<type>* iter = (cont).newIterator (); \ Steinberg::FDeleter <Steinberg::TIterator<type> > iterDeleter (iter);\ iter->last (); \ while (!iter->done ()) { \ type& varName = iter->previous ();
Defines a reverse loop.
#define ENDFOR } } |
Terminates the loop.